package com.hm.jiaowuxitong.dao;

import com.hm.jiaowuxitong.util.DBUtil;

import java.util.List;
import java.util.Map;

public class TeacherDaoImp implements ITeacherDao {
    @Override
    public int insertTeacher(Map<String, Object> oMap) {
        return DBUtil.jt.update("insert into 教师表 values(?,?,?,?,?,?,?)",
                new Object[]{

                        oMap.get("personId"),
                        oMap.get("name"),
                        oMap.get("age"),
                        oMap.get("sex"),
                        oMap.get("baseMoney"),
                        oMap.get("hour"),
                        oMap.get("hourMoney"),
                });
    }

    @Override
    public List<Map<String, Object>> selectTeacher() {
        return DBUtil.jt.queryForList("select * from 教师表");
    }
    @Override
    public List<Map<String, Object>> HselectTeachers(String id){
        return DBUtil.jt.queryForList("select * from loginTeacher where id=?",id);
    }
    public int HinsertTeacher(Map<String, Object> oMap) {
        return DBUtil.jt.update("insert into loginTeacher values(?,?)",
                new Object[]{
                        oMap.get("id"),
                        oMap.get("key"),
                });
    }
    @Override
    public List<Map<String, Object>> selectTeacher1(String id) {
        return DBUtil.jt.queryForList("select * from 教师表 where 教师号=?",id);
    }

    @Override
    public int ChangeTeacherPassword(Map<String, Object> oMap) {
        return DBUtil.jt.update("update loginteacher set `key`=? where id=?",
                new Object[]{
                        oMap.get("key"),
                        oMap.get("id"),
        });
    }

}
